package util;

public class Util
{
	public static void quitWithError(String message, int error) {
		System.err.println(message);
		System.exit(error);
	}

	public static Pair<String, String> splitOnFirstOccurrence(String s, char delim) {
		int i = 0;
		while (i < s.length() && s.charAt(i) != delim)
			++i;
		if (i == 0 || i == s.length())
			return null;
		return new Pair<String, String>(s.substring(0, i), s.substring(i + 1));
	}

	public static String capitalize(String s) {
		return s.substring(0,1).toUpperCase() + s.substring(1);
	}

	public static String prettyPrint(core.GameObject o) {
		return "<font color='blue'>" + (o == null ? "null" : o.getName()) + "</font>";
	}
}